import { Injectable } from '@angular/core';
import { DfHTTP } from '../../../lib/network/network.service';
import { NetworkConfig, TaskDetailResponse } from '../../../app/app.service';

@Injectable()
export class DetailService {

    constructor(private dfHTTP: DfHTTP) { }

    getTaskDetail(params): Promise<any> {

        return this.dfHTTP.post(NetworkConfig.paths.getTodoDetail, params)
            .then((res: TaskDetailResponse) => {
                for(let item of res.data.lines) {
                    item.total = item.unit_price * item.exp_count;
                } 
                return res;
            });
            
    }
    
}